import apis from "../../http/apis/apis"
export default {
    namespaced: true,
    state: {
        lessors: [],
        dataPage: {
            pageSize: 5,
            currentPage: 1,
            total: 10,
            freezeState: 1,
            _id: '',
            searchData: {
                input: '',
                value: 1
            }
        }
    },
    gatters: {

    },
    mutations: {
        getLessors(state, data) {
            state.lessors = data.data;
            state.dataPage.total = data.total;
        },
        setPageData(state, newPageData) {
            state.dataPage = newPageData;
        },
        setCurrentPage(state, newCurrentPage) {
            state.dataPage.currentPage = newCurrentPage;
        },
        setPageSize(state, newPageSize) {
            state.dataPage.pageSize = newPageSize
        }
    },
    actions: {

        async getLessors(context, param) {
            const { data } = await apis.adminLessors.getLessors(param);
            context.commit('getLessors', data);
        },
    }

}